//https://code.google.com/p/lab01cse2102/source/list
//http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html#contentpane
//http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html
//Marcus Li
//CSE 2102 
//lab 01 
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseListener;

import javax.swing.*;

/* FrameDemo.java requires no other files. */
public class FrameDemo
	{
		/**
		 * Create the GUI and show it. For thread safety, this method should be
		 * invoked from the event-dispatching thread.
		 */
		public FrameDemo()
			{
				createAndShowGUI();
			}

		private void createAndShowGUI()
			{
				JTextArea textArea = new JTextArea(5, 20);
				textArea.setEditable(true);
				textArea.setLineWrap(true);
				// add a couple of buttons
				JButton b1 = new JButton("Button A");
				JButton b2 = new JButton("Button B");
				// add a yellow label
				JLabel yellowLabel = new JLabel();
				yellowLabel.setOpaque(true);
				yellowLabel.setBackground(new Color(248, 213, 131));
				yellowLabel.setPreferredSize(new Dimension(200, 180));
				// add a menu
				JMenuBar menu = new JMenuBar();
				JMenu menu1 = new JMenu("first item");
				menu.add(menu1);
				menu1.add(new JMenuItem("firstlistitem1"));
				menu1.add(new JMenuItem("firstlistitem2"));
				menu1.add(new JMenuItem("firstlistitem3"));
				JMenu menu2 = new JMenu("list 2");
				menu.add(menu2);
				for (int i = 1; i <= 5; i++)
					{
						menu2.add(new JMenuItem("secondlistitem" + i));
					}
				// Create and set up the window.
				JFrame frame = new JFrame("Frame");
				frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				// Display the window.
				frame.setJMenuBar(menu);
				frame.getContentPane().add(textArea, BorderLayout.WEST);
				frame.getContentPane().add(b2, BorderLayout.SOUTH);
				frame.getContentPane().add(b1, BorderLayout.NORTH);
				frame.getContentPane().add(yellowLabel, BorderLayout.CENTER);
				frame.pack();
				frame.setVisible(true);
			}

		public static void main(String[] args)
			{
				new FrameDemo();
			}
	}
